 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<meta http-equiv="Cache-Control" content="No-Cache">
	<meta http-equiv="Pragma" content="No-Cache">

	<title>운세의 신</title>

	<link rel="stylesheet" type="text/css" href="/css/common.css">
	<link rel="stylesheet" type="text/css" href="/css/sub.css">
    <link rel="stylesheet" type="text/css" href="/css/mypage.css">
	
	<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
	<script src="/js/utility/common_util.js" type="text/javascript"></script>
	<script type="text/javascript">
<? if ($package['vip_coupon_qty'] == 0) : ?>
		function openGiveVipCoupon() {
			alert('남은 VIP 이용권이 없습니다.');
		}
<? else : ?>
		function openGiveVipCoupon() {
			openPopup("/mypage/vip/search_member", 520,430);
		}
<? endif ?>
	</script>
</head>
<body>
<div id="wrap">
	<!-- Header -->
	<? include_once $_SERVER['DOCUMENT_ROOT'].'/include/commons/main_header.php'; ?>
	<!--// Header -->

	<!--커튼 데코레이션-->
	<? include_once $_SERVER['DOCUMENT_ROOT'].'/include/commons/drape.php'; ?>
	<!--//커튼 데코레이션-->
	
	<!--컨텐츠-->
	<div id="content">
		<!--휘장-->
		<div class="keybox1">
		</div>
		<!--휘장-->

		<!--왼쪽 컨텐츠-->
		<div class="assistant">
			<!--왼쪽 메뉴-->
			<? include_once $_SERVER['DOCUMENT_ROOT'].'/include/commons/inc_lnb.php'; ?>
			<!--// 왼쪽 메뉴-->
			
			<!--추천테마-->
			<? include_once $_SERVER['DOCUMENT_ROOT'].'/include/static/theme.php'; ?>
			<!--//추천테마-->
			
			<!--오늘의 추천! 무료운세-->
			<? include_once $_SERVER['DOCUMENT_ROOT'].'/include/static/free.php'; ?>
			<!--//오늘의 추천! 무료운세-->
			
			<!--후기게시판-->
            <div class="side">
			<?php echo $INC_POSTSCRIPT_LIST ?>
            </div>
			<!--//후기게시판-->
			
			<!--회원배너-->
			<? include_once $_SERVER['DOCUMENT_ROOT'].'/include/static/member_join.php'; ?>
			<!--//회원배너-->
		</div>
		<!--//왼쪽 컨텐츠-->

		<!-- 메인컨텐츠-->
		<div class="cont">
			 <div class="mypage">
				<h3>VIP회원권 내역</h3>
				<!--가입상품 요약 정보 (include mypage/summary_inc.v.php-->
				<?php echo $INC_SUMMARY; ?>
				<!--//가입상품 요약 정보-->
				
				
				<div class="text">
					<ul>
						<li>운세의신에서 사용 가능한 이용권정보를 확인하실 수 있습니다.</li>
						<li>이용권에 따라 유효기간은 차이가 있으니 만료일 전에 사용하시기 바랍니다.</li>
					</ul>
				</div>
				<div class="viplist">
					<h4 class="title">이용권 잔여내역</h4>
					<table width="100%" summary="VIP이용권 내역" cellpadding="0" cellspacing="0">
						<caption class="blind">이용권 내역</caption>
						<colgroup>
							<col width="20%" />
							<col width="*" />
							<col width="10%" />
							<col width="10%" />
							<col width="10%" />
							<col width="15%" />
							<col width="10%" />
						</colgroup>
						<thead>
							<tr>
								<th scope="col" class="tle">회원권명</th>
								<th scope="col" class="stle">이용권명</th>
								<th scope="col" class="total">전체이용권</th>
								<th scope="col" class="use">사용이용권</th>
								<th scope="col" class="pay">잔여이용권</th>
								<th scope="col" class="date">사용기간</th>
								<th scope="col" class="gift">선물</th>
							</tr>
						</thead>
						<tbody>
<?	if ($package['package_cd'] != '1') : ?>
<?		if (empty($package['giver_id'])) : ?>
							 <tr>
							 	<td rowspan="5" class="tle"><?=$package['package_name']?> 회원권</td>
								<td class="stle">VIP 이용권</td>
								<td class="total"><?=$package['package_vip_coupon_qty']?>장</td>
								<td class="use"><?=$package['package_vip_coupon_qty']-$package['vip_coupon_qty']?>장</td>
								<td class="pay"><?=$package['vip_coupon_qty']?>장</td>
								<td class="date"><?=$package['start_dt']?><br /><em>~</em> <?=$package['end_dt']?></td>
								<td class="gift"><a href="javascript:;" onclick="openGiveVipCoupon()"><img src="/images/mypage/bt_gift.png" alt="선물하기" /></a></td>
							</tr>
<?		else : ?>
							 <tr>
							 	<td rowspan="5" class="tle"><?=$package['package_name']?> 이용권<br/>선물 받음</td>
								<td class="stle">VIP 이용권</td>
								<td class="total">-</td>
								<td class="use">-</td>
								<td class="pay">-</td>
								<td class="date">-</td>
								<td class="gift">-</td>
							</tr>
<?		endif ?>
<?	else : ?>
							 <tr>
							 	<td rowspan="5" class="tle">-</td>
								<td class="stle">-</td>
								<td class="total">-</td>
								<td class="use">-</td>
								<td class="pay">-</td>
								<td class="date">-</td>
								<td class="gift">-</td>
							</tr>
<?	endif ?>
<?	foreach ($coupon_list as $item) : ?>
							<tr>
								<td class="stle"><?=$item['service_group_name']?> 이용권</td>
								<td class="total"><?=$item['package_coupon_qty_str']?></td>
								<td class="use"><?=$item['package_coupon_qty']-$item['qty']?>장</td>
								<td class="pay"><?=$item['qty_str']?></td>
								<td class="date"><?=$package['start_dt']?><br /><em>~</em> <?=$package['end_dt']?></td>
								<td class="gift">-</td>
							</tr>
<?	endforeach ?>
						</tbody>
					</table>
				</div><!--//viplist--> 

				<div class="giftlist">
					<h4 class="title">VIP이용권 선물내역</h4>
					<table width="100%" summary="VIP이용권 선물내역" cellpadding="0" cellspacing="0">
						<caption class="blind">VIP이용권 선물내역</caption>
						<colgroup>
							<col width="*" />
							<col width="15%" />
							<col width="15%" />
							<col width="15%" />
							<col width="15%" />
						</colgroup>
						<thead>
							<tr>
								<th scope="col" class="tle">이용권명</th>
								<th scope="col" class="pay">유형</th>
								<th scope="col" class="use">수령자</th>
								<th scope="col" class="qty">수량</th>
								<th scope="col" class="date">사용일</th>
							</tr>
						</thead>
						<tbody>
<?	foreach ($vip_given_list as $item) : ?>
							<tr>
								<td class="tle"><?=$package['package_name']?> 회원권</td>
								<td class="pay">선물</td>
								<td class="use"><?=$item['receiver_id']?></td>
								<td class="qty">1장</td>
								<td class="date"><?=substr($item['create_dt'],0,10)?></td>
							</tr>
<?	endforeach ?>
						</tbody>
					</table>
				</div><!--//viplist--> 
			</div><!--mypage--> 
		</div>
		<!--// 메인컨텐츠-->
	</div>
	<!--컨텐츠-->

	<!-- Footer -->
	<? include_once $_SERVER['DOCUMENT_ROOT'].'/include/commons/main_footer.php'; ?>
	<!--// Footer -->
</div>
</body>
</html>